package cn.iocoder.yudao.module.resource.enums;

import cn.hutool.core.util.ObjUtil;
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 审核状态枚举
 *
 * @author 芋道源码
 */
@Getter
@AllArgsConstructor
public enum AuditStatusEnum implements ArrayValuable<Integer> {

    PENDING(0, "待审核"),
    APPROVED(1, "审核通过"),
    REJECTED(2, "审核拒绝");

    public static final Integer[] ARRAYS = Arrays.stream(values()).map(AuditStatusEnum::getStatus).toArray(Integer[]::new);

    /**
     * 状态值
     */
    private final Integer status;
    /**
     * 状态名
     */
    private final String name;

    @Override
    public Integer[] array() {
        return ARRAYS;
    }

    public static boolean isPending(Integer status) {
        return ObjUtil.equal(PENDING.status, status);
    }

    public static boolean isApproved(Integer status) {
        return ObjUtil.equal(APPROVED.status, status);
    }

    public static boolean isRejected(Integer status) {
        return ObjUtil.equal(REJECTED.status, status);
    }

}
